package entities;

import java.io.Serializable;

import dto.TransportDTO;

import java.lang.Long;
import java.lang.String;
import java.util.Date;

import javax.persistence.*;

/**
 * Entity implementation class for Entity: TransportEntity
 *
 */
@Entity
@Table(name="TRANSPORTS")
@NamedQueries({
				@NamedQuery(name=TransportEntity.FIND_ALL,
							query="SELECT t FROM TransportEntity t ORDER BY t.insertedOn ASC"),
				@NamedQuery(name=TransportEntity.FIND_FOR_USER,
							query="SELECT t FROM TransportEntity t WHERE t.available=1 AND t.disponibility > 0")
})

public class TransportEntity extends BasicProduct implements Serializable {
	private static final long serialVersionUID = 1L;
	
	public static final String FIND_ALL = "TransportEntity.findAll";
	public static final String FIND_FOR_USER = "TransportEntity.findForUser";
	
	private String type;
	private Integer passengers;
	private Integer classNumber;
	private String fromPlace;
	private String toPlace;
	@Temporal(javax.persistence.TemporalType.DATE)
	private Date departureDate;
	@Temporal(javax.persistence.TemporalType.DATE)
	private Date departureTime;	
	private Long flightId;
	private String company;

	

	public TransportEntity() {
		super();
	}   

	public TransportEntity(TransportDTO transport) {
		super(transport.getId(),transport.isAvailable(), transport.getDisponibility(), transport.getPrice(), transport.getAdmin());
	this.type = transport.getType();
	this.passengers = transport.getPassengers();
	this.classNumber = transport.getClassNumber();
	this.fromPlace = transport.getFromPlace();
	this.departureDate = transport.getDepartureDate();
	this.departureTime = transport.getDepartureTime();
	this.toPlace = transport.getToPlace();

	this.flightId = transport.getFlightId();
	this.company = transport.getCompany();
	}

	public String getType() {
		return type;
	}

	public void setType(String type) {
		this.type = type;
	}

	public Integer getPassengers() {
		return passengers;
	}

	public void setPassengers(Integer passengers) {
		this.passengers = passengers;
	}

	public Integer getClassNumber() {
		return classNumber;
	}

	public void setClassNumber(Integer classNumber) {
		this.classNumber = classNumber;
	}

	public String getFromPlace() {
		return fromPlace;
	}

	public void setFromPlace(String fromPlace) {
		this.fromPlace = fromPlace;
	}

	public String getToPlace() {
		return toPlace;
	}

	public void setToPlace(String toPlace) {
		this.toPlace = toPlace;
	}

	public Date getDepartureDate() {
		return departureDate;
	}

	public void setDepartureDate(Date departureDate) {
		this.departureDate = departureDate;
	}

	public Date getDepartureTime() {
		return departureTime;
	}

	public void setDepartureTime(Date departureTime) {
		this.departureTime = departureTime;
	}

	public Long getFlightId() {
		return flightId;
	}

	public void setFlightId(Long flightId) {
		this.flightId = flightId;
	}

	public String getCompany() {
		return company;
	}

	public void setCompany(String company) {
		this.company = company;
	}

	@Override
	public String toString() {
		return "TransportEntity [type=" + type + ", passengers=" + passengers
				+ ", classNumber=" + classNumber + ", fromPlace=" + fromPlace
				+ ", toPlace=" + toPlace + ", departureDate=" + departureDate
				+ ", departureTime=" + departureTime + ", flightId=" + flightId
				+ ", company=" + company + "]";
	}


	
}


